package house

// Director 指挥者类
type Director struct {
	builder IBuilder
}

func newDirector(b IBuilder) *Director { //根据传递来的构造器， 创建指挥者
	return &Director{
		builder: b,
	}
}

func (d *Director) setBuilder(b IBuilder) { //给指挥者设置要使用的构造器
	d.builder = b
}

func (d *Director) buildHouse() House { //指挥者选择构造的步骤
	d.builder.setDoorType()
	d.builder.setWindowType()
	d.builder.setNumFloor()
	d.builder.setSwimPool()
	return d.builder.getHouse()
}
